$.delChannel = function delChannel(id) {
    let ids = [];
    if (id == undefined) {
        let $checkbox = $("tbody").find("input[type='checkbox']");
        $checkbox.each(function(index, item) {
            if ($(this).is(':checked')) {
                ids.push($(this).val());
            }
        });
    } else {
        ids.push(id);
    }
    if (ids.length == 0) {
        alert("请至少选择一个频道");
        return;
    }
    var dialog = $.confirm({
        title: "确定是否删除频道",
        message: "确定是否删除频道",
        confirm: function() {
            $.myAjax({
                url: "channel/delChannel.do",
                dataType: "json",
                contentType: "application/json",
                data: JSON.stringify({
                    ids: ids
                }),
                success: function(result) {
                    var table = $(".table").DataTable();
                    table.draw();
                }
            });
        }
    });
}

$.confChannel = function confChannel(id) {
    let ids = [];
    if (id == undefined) {
        let $checkbox = $("tbody").find("input[type='checkbox']");
        $checkbox.each(function(index, item) {
            if ($(this).is(':checked')) {
                ids.push($(this).val());
            }
        });
    } else {
        ids.push(id);
    }
    if (ids.length == 0) {
        alert("请至少选择一个频道");
        return;
    }
    var dialog = $.confirm({
        title: "确定是否下发频道",
        message: "确定是否下发频道",
        confirm: function() {
            $.myAjax({
                url: "channel/confChannel.do",
                dataType: "json",
                contentType: "application/json",
                data: JSON.stringify({
                    ids: ids
                }),
                success: function(result) {
                    alert("下发成功");
                }
            });
        }
    });
}
